package com.itheima.demoString;

import java.util.Scanner;

public class Demo03String {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String userName = "admin";
        String passWord = "123456";
        for (int i = 0; i < 3; i++) {
            System.out.println("请输入用户名:");
            String scUserName = sc.next();
            System.out.println("请输入登录密码:");
            String scPassWord = sc.next();
            if (scUserName.equals(userName) && scPassWord.equals(passWord)) {
                System.out.println("登陆成功!");
                break;
            } else {
                if (i == 2){
                    System.out.println("对不起,你今日登陆的机会已用完");
                }else
                    System.out.println("登录失败,您还有" + (2 - i) + "次机会重新登录");
            }
        }
    }
}
